package com.cole.gx095.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "roleinfo")
public class Roleinfo {
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Id
    @Column(name = "Id")
    private int id;
    @Basic
    @Column(name = "RoleName")
    private String roleName;
    @Basic
    @CreatedDate
    @Column(name = "CreateDate")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Timestamp createDate;
    @Basic
    @Column(name = "AdminNum")
    private Integer adminNum;
    @Basic
    @Column(name = "RoleDesc")
    private String roleDesc;
    @Basic
    @Column(name = "Status")
    private Integer status;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    public Integer getAdminNum() {
        return adminNum;
    }

    public void setAdminNum(Integer adminNum) {
        this.adminNum = adminNum;
    }

    public String getRoleDesc() {
        return roleDesc;
    }

    public void setRoleDesc(String roleDesc) {
        this.roleDesc = roleDesc;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Roleinfo roleinfo = (Roleinfo) o;
        return id == roleinfo.id && Objects.equals(roleName, roleinfo.roleName) && Objects.equals(createDate, roleinfo.createDate) && Objects.equals(adminNum, roleinfo.adminNum) && Objects.equals(roleDesc, roleinfo.roleDesc) && Objects.equals(status, roleinfo.status);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, roleName, createDate, adminNum, roleDesc, status);
    }
}
